package com.bktalk;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.Button;
import android.widget.TextView;

public class SecondActivity extends Activity {
	TextView viewsum = null;
	Button button1 = null;
	
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.second);
    	System.out.println("SecondActivity: onCreate");
    	Intent intent = getIntent();
    	int add1 = intent.getIntExtra("add1", 100);
    	int add2 = intent.getIntExtra("add2", 100);
    	System.out.println("add1 = " + add1 + "");
    	System.out.println("add2 = " + add2 + "");
    	int sum = add1 + add2;
    	button1 = (Button)findViewById(R.id.button1);
    	button1.setText(sum + "");
    	System.out.println("sum = " + sum + "");

    	//viewsum = (TextView)findViewById(R.id.viewsum1);
    	//viewsum.setText(sum);
    }
    
    public void onStart()
    {
    	System.out.println("SecondActivity: onStart");
    	super.onStart();
    }
    
    protected void onRestart()
    {
    	System.out.println("SecondActivity: onRestart");
    	super.onRestart();
    }
    
    protected void onResume()
    {
    	System.out.println("SecondActivity: onResume");
    	super.onResume();
    }
    
    protected void onPause()
    {
    	System.out.println("SecondActivity: onPause");
    	super.onPause();
    }
    
    protected void onStop()
    {
    	System.out.println("SecondActivity: onStop");
    	super.onStop();
    }
    
    protected void onDestroy()
    {
    	System.out.println("SecondActivity: onDestroy");
    	super.onDestroy();
    }
    
}